package com.david.dubbo.xml;

import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.extension.ExtensionLoader;
import org.apache.dubbo.registry.Registry;
import org.apache.dubbo.registry.RegistryFactory;

/**
 * @author David
 * @version V1.0
 * @Package com.david.dubbo.xml
 * @date 2021/4/15 18:55
 */
public class DubboRouterMain {
    public static void main(String[] args) {
        RegistryFactory registryFactory = ExtensionLoader.getExtensionLoader(RegistryFactory.class).getAdaptiveExtension();
        Registry registry = registryFactory.getRegistry(URL.valueOf("zookeeper://192.168.219.102:2181?timeout=15000"));
        registry.register(URL.valueOf("condition://0.0.0.0/com.david.dubbo.xml.service.DavidService?" +
                "category=routers&force=true&dynamic=true&rule="+URL.encode("=> host !=192.168.219.1")));
    }

}
